Next: 4.6.10 Adding New Devices Up: 4.6 The PIC16 port Previous: 4.6.8 Header Files Contents Index
Subsections

- Building the libraries
- Output of float values via printf()

##
4.6.9 Libraries

The libraries that PIC16 port depends on are the microcontroller device libraries which contain the symbol definitions for the microcontroller special function registers. These libraries have the format pic18fxxxx.lib, where xxxx is the microcontroller identification number. The specific library is selected automatically by the compiler at link stage according to the selected device.

Libraries are created with gplib which is part of the gputils package `http://sourceforge.net/projects/gputils`.

### Building the libraries

Before using SDCC/pic16 there are some libraries that need to be compiled. This process is done automatically if gputils are found at SDCC's compile time. Should you require to rebuild the pic16 libraries manually (e.g. in order to enable output of float values via `printf()`, see below), these are the steps required to do so under Linux or Mac OS X (cygwin might work as well, but is untested):

  cd device/lib/pic16

  ./configure.gnu

  cd ..

  make model-pic16

  su -c 'make install' # install the libraries, you need the root password

  cd ../..

If you need to install the headers too, do:

  cd device/include

  su -c 'make install' # install the headers, you need the root password

### Output of float values via printf()

The library is normally built without support for displaying float values, only <NO FLOAT> will appear instead of the value. To change this, rebuild the library as stated above, but call `./configure.gnu -enable-floats` instead of just `./configure.gnu`. Also make sure that at least `libc/stdio/vfprintf.c` is actually recompiled, e.g. by `touch`ing it after the `configure` run or deleting its `.o` file.

The more common appraoch of compiling `vfprintf.c` manually with `-DUSE_FLOATS=1` should also work, but is untested.

Next: 4.6.10 Adding New Devices Up: 4.6 The PIC16 port Previous: 4.6.8 Header Files Contents Index